package com.hengfoxwolf.definerecyclerviewlayoutmanagerdemo
import androidx.recyclerview.widget.RecyclerView
import com.hengfoxwolf.bannerdemo.showToast
import com.hengfoxwolf.definerecyclerviewlayoutmanagerdemo.databinding.ContentRvItemBinding

/**
 *@desc  BottomContentRvAdapter
 *@author liuliheng
 *@time 2022/12/22  10:29
 **/
class ContentRvAdapter(dataSet:MutableList<ContentLayoutItem>) : BaseRvAdapter<ContentLayoutItem, ContentRvItemBinding>(dataSet) {

    override fun getLayoutId(): Int = R.layout.content_rv_item

    override fun bindData(holder: ViewHolder, dataItem: ContentLayoutItem, position: Int) {
        holder.binding.rvItemTvContent.text = dataItem.content
//        val layoutParams = holder.binding.root.layoutParams as RecyclerView.LayoutParams
//        layoutParams.bottomMargin =
//            if (position == itemCount - 1) holder.binding.root.context.resources.getDimension(R.dimen.dp_10).toInt()
//            else 0
//        holder.binding.root.layoutParams = layoutParams
        holder.binding.root.setOnClickListener {
            holder.binding.root.context.showToast(dataItem.content)
        }
    }
}